home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 44
/
Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso
/
-in_the_mag-
/
basics
/
amigabasic
/
bref.lha
/
Bref
/
Bref.doc
< prev
next >
Wrap
Text File
|
1991-06-06
|
9KB
|
262 lines
Documentation for Program BREF May 1991
Version 2.0 WorkBench or CLI executable
Dick Taylor Glastonbury, Connecticut USA
Contents
1. Components 7. Options
2. What does BREF do? 8. Program Limitations
3. How to use 9. Potential Problems
4. ASCII file for input 10. Program History
5. Operational description 11. Programming Notes
6. FileWindow 12. BREF Communications
1. COMPONENTS
bref -- executable
bref.c, bref2.c, bref3.c, bref4.c -- C language source code modules
bref.doc -- documentation
HSI.Color -- Basic code sample in ASCII
2. WHAT DOES BREF DO?
BREF makes a Cross Reference Table for AmigaBASIC code. This consists of a
numbered listing of the BASIC code, plus a table showing variable/label
usage. Highly useful tool for Basic programmers. Printer output recom-
mended. This version, 2.0 , is executable from WorkBench or CLI/Shell.
3. HOW TO USE
==> Your BASIC code must be in ASCII, not the default binary <==
Workbench: Double click the BREF icon, follow directions for specifying
options and input.
CLI/Shell, printer output: bref >prt: prog.name
Can specify options; see #7.
4. ASCII File for BREF input
To save your BASIC code in ASCII, use the BASIC output window:
LIST ,"prog.name"
If you try to run BREF with saved binary, the run aborts with this message:
"File prog.name is binary, can't process. ASCII req."
You can also use the SAVE "prog.name",a command to make an ASCII file, but
this has a drawback: It changes the default mode of this program for this
session to ASCII, and any further saves of any type will be in ASCII until
you specify binary. Avoid this "GOTCHA!" by using LIST.
5. OPERATIONAL DESCRIPTION
a. CLI/Shell-- command line is the sole user interface, same as v1.01.
Exception: Invoke with just "bref", no arguments, gives WB mode.
b. WorkBench-- there are 4 displays to provide the user interface.
--OPTION Displays 8 options with default settings, and provision
to change them. Click buttons for HELP, SAVE, OK.
--HELP A series of displays with usage information.
--FileWindow Input selector. Click buttons: OPTION, HELP,
GO = start execution, CANCEL = end run.
--ERROR Display error message.
SAVE of Options: When you click on the SAVE button of the OPTION
display, the current settings of all 8 options are written out to a file
in the current directory (filename = BREF.Option), and exit OPTION display.
For WorkBench execute, the program starts by looking for the saved
options file. If not found, it starts with the OPTION display. If found,
it restores the options from the file and starts with FileWindow. You can,
or course, go to OPTION for further changes if desired.
The OK button on OPTION uses the current settings for the run, but
does not save them.
c. Abort execution: CLI/Shell -- CTRL/C
WorkBench -- Click on CloseWindow
CLI, no arguments -- Either of above
6. FILEWINDOW
On initial display, FW shows the contents of the current directory--
both directories and files. Can click on a directory to show its contents.
Just click on the file you want for input, & click GO to start execution.
You can scroll the display with the slider bar.
You can click-select a unit for display-- df0: df1: dh0: ram:
You can click on "<" to back up to the parent directory.
You can enter a filename suffix in the "Ext" field, and then only
filenames with that ending will be displayed, along with all directories.
You can click in File or Drawer/File to type in your input name or
path/name. For File, press of RETURN starts execution, same as GO.
7. OPTIONS
7.1 - Workbench
Use the OPTION display to set options as desired. You can click on the
"HELP" box to review on-line how to use the options.
Note on OUTPUT NAME option: Default setting is "PRT:" = printer.
Can change this to any file specification wanted, with one exception --
If invoking from WorkBench, cannot get screen output directly. If invoke
from CLI (no arguments), can use * for direct screen output. Of course you
can easily get indirect screen output by directing output to a temporary
file (ram:Temp for example), and then view this with an edit program.
7.2 - CLI/Shell
The first letter of each option may be upper or lower case. Here is an
example of running BREF with options:
bref >prt: -Q -W132 your.prog.name
Specify as many options as needed; place preceding the program name, any
order. Precede each option with a minus sign.
-Q -don't print the BASIC code listing (Quiet).
-Wnnn -set page Width to nnn instead of default 80; max is 132.
-Lnnn -set page Length to nnn instead of default 66.
-Hccc -set page Heading to 'ccc' rather than the program name.
-S -Suppress Form Feeds; useful for screen output.
-K -show the BASIC Keywords in the the cross ref table.
Default-- the BASIC keywords are omitted.
-E -print the BASIC code 12 char's/inch (Elite type) instead of
the default 10 char's/inch. For a default 80-char
line, this produces a 96-char line. This tends to cut down on
the annoying lines which are split into 2 lines on printing.
-? -display this list.
8. PROGRAM LIMITATIONS
a. Max name size: AmigaBASIC 40 char's; BREF 15 char's.
Names longer than 15 char's appear in BREF table split in parts.
b. BREF uses up to four digits (9999) for the assigned line numbers,
enough for 180+ pages. For > 9,999 lines, split in parts to process.
9. POTENTIAL PROBLEMS
9.1 WorkBench Version Serious Error
If the WB version has a serious problem such as failing to open Intuition
or the Window, you will not see any of the error messages; the run will
just terminate. You can easily repeat the situation by running from
CLI/Shell with just "BREF", no command line arguments. This will run
BREF in WB mode, and you should see any error messages in the CLI window.
9.2 Stack
BREF makes heavy use of recursion, which is a stack-intensive operation.
In running very large BASIC programs through BREF, it is possible that you
may crash the system (guru or whatever) due to exceeding the stack (default
stack size is 4000). If this happens, try increasing the stack to 8000 and
rerun. The largest program I have run is a little over 1,000 lines-- no
problem with the default stack.
10. PROGRAM HISTORY
BREF is a modification of CREF, the C language cross referencer.
CREF appears on Fred Fish Disk #166. It was written by Mike Edmonds in
1981, and ported to the Amiga by Joel Swank in 1987. I produced the initial
BREF v1.01 in 1989; it appears on FF#283. The present version of BREF
benefits greatly from use of Anders Bjerin's routine FileWindow for input
selection. Thanks Anders!!
Credits: Thanks to: BOB BROMLEY, Malton Ontario Canada, and
DOUG NELSON, Omaha Nebraska, for suggested improvements, bug
reporting and testing; KARL RIESEN, Oberrieden Switzerland, for
suggesting the WorkBench executable version, and invaluable ideas,
advice, and testing to reach this goal; artist/son ALAN TAYLOR
for the "Bee"-REF icon, made with Deluxe Paint.
11. PROGRAMMING NOTES
a. BREF was compiled with Manx Aztec C v. 5.0:
cc -wn bref.c
cc -wn bref2.c
cc -wn bref3.c
cc -wn bref4.c
ln bref.o bref2.o bref3.o bref4.o -lm -lc
b. Program changes to CREF to produce BREF:
-AmigaBASIC keyword list, 202 items
-Char set for word definition: drop # _ add . % & ! # $
-Comment definition: ' or REM
-Default print line 80 char (was 132)
-Add options -S, -K, -E
-Assigned line no. print field width 4 char (was 6)
c. I encountered significant trouble with implementing the AmigaBASIC
keyword list. When I entered the list in alphabetic order and tried to run
with stack = 4000, it crashed (guru) in a variety of places depending on
other system factors. It turns out to be a problem caused by heavy
recursion usage -- entering items (both keywords and program words) into a
tree. The solution was to enter the keywords in binary search order,
thereby minimizing recursion level depth. With this arrangement of
keywords I've had no problem running with stack of 4000.
d. Aztec C V 5.0 Date Anomaly: The Amiga standard time value is --
"Seconds since Jan 1, 1978"
V 5.0 has changed this standard to -- "Seconds since Jan 1, 1970"
Functions time() and ctime() use this convention.
Problem: If you use ctime() to print a file date (Amiga DOS),
the date is 8 years too old. I have patched the problem by adding
a constant (252460800 -- 1970 to 1978 in sec's) to the input file time
value before passing it to ctime().
e. The FileWindow routine appears on FF #336, was written by Anders
Bjerin of Lidingo, Sweden. Anders encourages others to use/modify this
routine in any way desired, which is what I have done:
-Delete gadgets SAVE, DELETE
-Rename gadget LOAD to GO
-Add gadgets ram:, HELP, OPTION
-Replaced function stricmp() (not available in Aztec) with strcmp(),
but with added processing to put the strings in lower case
before the compare.
12. FOR BREF COMMUNICATIONS--
Dick Taylor If you've found a program bug,
99 Valley View Rd or have a program change to suggest,
Glastonbury CT or want to correspond,
06033-3621 USA I'll be glad to hear from you.
Tel (203) 633-0100